from PIL import Image

# 打开图片
img = Image.open("C:\\Users\Administrator\Desktop\self_2000_plus.jpg")

# 保存时指定 dpi
img.save("C:\\Users\Administrator\Desktop\self_2000_plus_dpi_300.jpg", dpi=(300, 300))
